//
//  UIButton+Ex.swift
//  微博
//
//  Created by Mr.Deng on 15/9/23.
//  Copyright © 2015年 Mr.Deng. All rights reserved.
//

import UIKit

extension UIButton {
    convenience init(title:String, color:UIColor, fontSize:CGFloat, backgroundImageName:String) {
        self.init()
        setTitle(title, forState:  .Normal)
        setTitleColor(color, forState:  .Normal)
        titleLabel!.font = UIFont.systemFontOfSize(fontSize)
        setBackgroundImage(UIImage(named: backgroundImageName), forState:  .Normal)
        setBackgroundImage(UIImage(named: backgroundImageName + "_highlighted"), forState:  .Highlighted)
        
        sizeToFit()
    }
}

